import 'package:backend.core/core/domain/entities/google_play/google_play_purchased_subscription_info_price_change_status.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_purchased_subscription_price_change_status.dart';

abstract class CreateGooglePlayPurchasedSubscriptionInfoPriceChangeStatusFromApiOne {
  GooglePlayPurchasedSubscriptionInfoPriceChangeStatus call({
    required GooglePlayApiPurchasedSubscriptionPriceChangeStatus apiPriceChangeStatus,
  });
}

class CreateGooglePlayPurchasedSubscriptionInfoPriceChangeStatusFromApiOneImpl
    implements CreateGooglePlayPurchasedSubscriptionInfoPriceChangeStatusFromApiOne {
  const CreateGooglePlayPurchasedSubscriptionInfoPriceChangeStatusFromApiOneImpl();

  @override
  GooglePlayPurchasedSubscriptionInfoPriceChangeStatus call({
    required GooglePlayApiPurchasedSubscriptionPriceChangeStatus apiPriceChangeStatus,
  }) {
    switch (apiPriceChangeStatus) {
      case GooglePlayApiPurchasedSubscriptionPriceChangeStatus.absent:
        return GooglePlayPurchasedSubscriptionInfoPriceChangeStatus.absent;
      case GooglePlayApiPurchasedSubscriptionPriceChangeStatus.accepted:
        return GooglePlayPurchasedSubscriptionInfoPriceChangeStatus.accepted;
      case GooglePlayApiPurchasedSubscriptionPriceChangeStatus.pending:
        return GooglePlayPurchasedSubscriptionInfoPriceChangeStatus.pending;
    }
  }
}
